package cn.lxm.cas.client2.controller;

import cn.lxm.cas.client2.config.CasProperties;
import com.google.gson.Gson;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.thymeleaf.util.DateUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;


/**
 * @author LXM
 * @Title: cas
 * @Description:
 * @date 2018/9/1下午4:42
 */
@RestController
@CrossOrigin
public class ResourceController {

    @GetMapping("/resource")
    @PreAuthorize("hasAnyRole('ROLE_USER')")
    public CasProperties test(HttpServletRequest reques, HttpServletResponse response) {

        CasProperties properties = new CasProperties();
        properties.setAppLoginUrl("12313133");
        properties.setCasServerLogoutUrl("33333");
        return properties;

    }


    @RequestMapping(value = "test", produces = "application/json; charset=UTF-8", method = {RequestMethod.GET, RequestMethod.POST})
    @PreAuthorize("hasAnyRole('ROLE_USER')")
    public CasProperties initDbDatasC() {
        CasProperties properties = new CasProperties();
        properties.setAppLoginUrl("12313133");
        properties.setCasServerLogoutUrl("33333");
        return properties;
    }
}
